# the minimum version of CMake.
cmake_minimum_required(VERSION 3.28.2)
project(oal)

set(NATIVERENDER_ROOT_PATH ${CMAKE_CURRENT_SOURCE_DIR})
set(CMAKE_VERBOSE_MAKEFILE ON)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC -Wno-int-conversion -Wl,-Bsymbolic")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC -Wno-int-conversion -Wl,-Bsymbolic")

if(DEFINED PACKAGE_FIND_FILE)
    include(${PACKAGE_FIND_FILE})
endif()

include_directories(${NATIVERENDER_ROOT_PATH}
                    ${NATIVERENDER_ROOT_PATH}/include
                    ffmpeg/include)

add_library(${CMAKE_PROJECT_NAME} SHARED
napi_init.cpp
utils.cpp)

target_link_libraries(${CMAKE_PROJECT_NAME} PRIVATE libace_napi.z.so)
target_link_libraries(${CMAKE_PROJECT_NAME} PRIVATE libhilog_ndk.z.so)
target_link_libraries(${CMAKE_PROJECT_NAME} PRIVATE libohfileuri.so)
target_link_libraries(${CMAKE_PROJECT_NAME} PRIVATE libz.so)
target_link_libraries(${CMAKE_PROJECT_NAME} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/ffmpeg/libs/${OHOS_ARCH}/libavcodec.a)
target_link_libraries(${CMAKE_PROJECT_NAME} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/ffmpeg/libs/${OHOS_ARCH}/libavformat.a)
target_link_libraries(${CMAKE_PROJECT_NAME} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/ffmpeg/libs/${OHOS_ARCH}/libavutil.a)
target_link_libraries(${CMAKE_PROJECT_NAME} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/ffmpeg/libs/${OHOS_ARCH}/libswresample.a)